/*
author:pokemonWei
start_date:2016-11-9
version:1.0
*/


#include <iostream>
#include<algorithm>

using namespace std;

int getFromEn(int n,char f);

int main(void){


    // std::cout << 'f'+'i'+'v'+'e' << std::endl;
    // std::cout << 'n'+'i'+'n'+'e' << std::endl;

  int a,b;
  a=b=0;
  int temp = 0;
  char ch = '\0';
  char f = '\0';

  do {
    a = b = 0;
    ch = f ='\0';

    cin.get(ch);
    while(ch != '+')
    {
      temp = 0;
      f = ch;
    //  std::cout << f << std::endl;
      while(ch != ' ' && ch != '+')
      {
        //std::cout << ch << std::endl;
        temp += ch;
        cin.get(ch);
      }
      cin.get(ch);
      a = a *10 + getFromEn(temp,f);
    }


    cin.get(ch);
    while(ch != '=')
    {
      temp = 0;
      //std::cin >> ch;
      f = ch;
      while(ch != ' ' && ch != '=')
      {
        temp += ch;
        cin.get(ch);
      }
        cin.get(ch);
      b = b*10 + getFromEn(temp,f);
    }
    if(a!=0 || b!=0)
      std::cout << a + b << std::endl;
    while (ch!='\n') {
      cin.get(ch);
    }
  } while(a != 0 || b !=0);

  return 0;
}

int getFromEn(int ascSum , char f)
{
  switch (ascSum) {
    case 'o'+'n'+'e':
      return 1;
    case 't'+'w'+'o':
      return 2;
    case 't'+'h'+'r'+'e'+'e':
      return 3;
    case 'f'+'o'+'u'+'r':
      return 4;
    // case 'f'+'i'+'v'+'e':
    //   return 5;
    case 's'+'i'+'x':
      return 6;
    case 's'+'e'+'v'+'e'+'n':
      return 7;
    case 'e'+'i'+'g'+'h'+'t':
      return 8;
    case 'n'+'i'+'n'+'e':
      if(f == 'n')
        return 9;
      else

        return 5;
    case 'z'+'e'+'r'+'o':
      return 0;

  }

  return 0;


}
